#!/usr/bin/python
# -*- coding: utf-8 -*-  
"""
@Project : hello 
@file : check_every_bu_sql.py
@Author : shenj
@time : 2025/6/5 18:13
@func :
"""
from com.cn.for_cdc.common.SimpleMySQLClient import SimpleMySQLClient
from com.cn.for_cdc.common.cdc_conmons import cdc_mysql_pro_cons

if __name__ == '__main__':

    print('----------------------------------------------------------------------------------------------------------------------------------------')
    sql="select * from asw_etl_${BU}_job.XX_JOB_LOG   where job_name ='flinkTaskMonitoringJob' order by CREATED_TIME desc limit 5;"
    bu_list = ['kvn', 'kvb', 'wtctr', 'drlv', 'drlt', 'tps', 'icinl', 'icibe']
    for bu in bu_list:
        db_config=cdc_mysql_pro_cons[f'{bu}_pro_job']
        db = SimpleMySQLClient(**db_config)
        quary_sql = sql.replace('${BU}',bu)
        print(quary_sql)
        result = db.query(quary_sql)
        for row in result:
            print(row)
    print('----------------------------------------------------------------------------------------------------------------------------------------')



